
<!-- dataTable模板 --> 
<script type="text/html" id="template_dataTable">
	<div class="layui-form table-info" style="width: 100%;height: auto;overflow:auto; position: relative;margin: 0;" data-spy="scroll" data-target="#navbar-example" data-offset="0" >
		<table class="table table-bordered">
			<tbody>
			<tr>
				{{# if(d.dataTool.titleCheckbox!=undefined&&d.dataTool.titleCheckbox){}}
				<th>
					<input lay-skin="primary" lay-filter="allChoose" type="checkbox">全选
				</th>
				{{#}}}

				{{# layui.each(d.dataTool.title, function(index, item){ }}
				<th>{{item}}</th>
				{{#  }); }}
			</tr>
			{{#  layui.each(d.list, function(index, listItem){ }}
			{{#  var data_obj = new Array(); }}
			{{#  layui.each(listItem, function(key, value){ }}
			{{# data_obj.push(key+":'"+value+"'");}}
			{{#  }); }}
			{{# data_obj= "{"+data_obj.join(',')+"}"; }}
			<tr>
				{{# if(d.dataTool.titleCheckbox!=undefined&&d.dataTool.titleCheckbox){}}
				<td>
					<input lay-skin="primary" lay-filter="oneCbx" name="cbx" value="{{data_obj}}"  type="checkbox">
				</td>
				{{#}}}
				{{#  layui.each(d.dataTool.title, function(titleKey, titleValue){ }}
				{{#  layui.each(listItem, function(key, value){ }}
				{{# if(d.dataTool.title[key]!=undefined&&key==titleKey){}}

                {{# var flag=false;}}
				{{# if(d.dataTool.editField!=undefined){}}
					{{# layui.each(d.dataTool.editField, function(editKey, editValue){ }}
						{{# if(editValue['field']==key){}}
							{{# flag=true;}}
							{{# if(editValue['type']=='text'){}}
								<td field="{{key}}" ondblclick="celledit({{data_obj}},'{{key}}','{{value}}',this,'text','')" >
							{{# }}}
							{{# if(editValue['type']=='select'){}}
									{{# var str="";}}
									{{#  layui.each(editValue['selectArray'], function(arrKey, arrValue){ }}
									{{# if(arrValue["id"]!=undefined){}}
									{{#  str += arrValue["id"]+"_"+arrValue["value"]+"-";}}
									{{#}}}
									{{#  }); }}
								<td field="{{key}}" ondblclick="celledit({{data_obj}},'{{key}}','{{value}}',this,'select','{{str}}')" >
							{{#}}}
						{{#}}}
					{{#})}}

				{{# if(!flag){}}
						<td field="{{key}}">
				{{#}}}

				{{#}}}
				{{# if(d.dataTool.editField==undefined){}}
					<td field="{{key}}">
				{{#}}}

					{{# if(d.dataTool.href!=undefined&&d.dataTool.href.field==key){}}
					<a  href="javascript:;" onclick="{{d.dataTool.href.event}}({{data_obj}})">
						{{#}}}

						{{#  layui.each(d.dataTool.stateData, function(stateKey, stateValue){ }}
						{{# if(stateValue['stateField']==key){}}
						{{#  layui.each(stateValue.stateArray, function(arrKey, arrValue){ }}
						{{# if(arrValue[value]!=undefined){}}
						{{#  value = '<font style='+arrValue.style+'>'+arrValue[value]+'</font>'}}
						{{#}}}
						{{#  }); }}
						{{#}}}
						{{#  }); }}
						{{# if(value==0 && key=="state"){ }}
						{{# var s="启用" }}
						{{ s }}
						{{#}}}
						{{# if(value==null){ }}
						{{# }else if(value==""){ }}
						{{# }else if(value==1&& key=="state"){ }}
						禁用
						{{# }else{ }}
						{{value}}
						{{#}}}

						{{# if(d.dataTool.href!=undefined&&d.dataTool.href.hrefField==key){}}
					</a>
					{{#}}}
				</td>
				{{#}}}
				{{#  }); }}
				{{#  }); }}

				{{# if(typeof(d.dataTool.btn) == "object"){ }}
				<td class="btn-operate">
					{{#  layui.each(d.dataTool.btn, function(index, item){ }}
					{{# if(item.event == "updateObj"){}}
					<button type="button" class="btn btn-edit " onclick="{{item.event}}({{data_obj}})">{{item.name}}</button>
					{{# }else if(item.event == "delObj"){}}
					<button type="button" class="btn btn-delete " onclick="{{item.event}}({{data_obj}})">{{item.name}}</button>
					{{# }else{}}
					<button type="button" class="btn btn-detail "  onclick="{{item.event}}({{data_obj}})">{{item.name}}</button>
					{{# }}}

					{{#  }); }}
				</td>
				{{# }}}

				{{# if(typeof(d.dataTool.btnHref) == "object"){ }}
				<td>
					{{#  layui.each(d.dataTool.btnHref, function(index, item){ }}
					<a  href="javascript:;" onclick="{{item.event}}({{data_obj}})" >
						{{# var styleCss = ""; }}
						{{# if(item.style!=undefined){ }}
						{{# styleCss = item.style; }}
						{{# }}}
						<font style="{{styleCss}}">
							{{item.name}}
						</font>
					</a>
					{{#  }); }}
				</td>
				{{# }}}
			</tr>
			{{#  }); }}





			<!-- 如果设置了 需要 汇总-->
			{{# if(d.countList!=undefined&&d.countList.length!=0){}}
			{{# if(d.dataTool.isCount!=undefined&&d.dataTool.isCount>0){}}
			<tr>
				{{#  layui.each(d.dataTool.title, function(titleKey, titleValue){ }}
					{{# var flags = false; var val = "";}}
					{{# layui.each(d.countList, function(index, listItem){ }}
						{{# layui.each(listItem, function(key, value){ }}
							{{# if(key==titleKey){}}
								{{# flags=true; val = value;}}
							{{#}}}
						{{#});}}
					{{#});}}
					{{#if(titleKey=='serial_number'){}}
						<td>汇总:</td>
					{{#} else {}}
						{{#if(flags){}}
							<td>{{val}}</td>
						{{#}else {}}
							<td></td>
						{{#}}}
					{{#}}}
				{{#});}}
			</tr>
			{{#}}}
			{{#}}}

			{{# if(d.dataTool.noDataStatus!=undefined&&d.dataTool.noDataStatus){}}
				{{# if($.isEmptyObject(d.list)||d.list.length==0){}}
					{{# var size = Object.getOwnPropertyNames(d.dataTool.title).length;}}
						{{# if(size>0 ){ }}
						<tr>
							<td colspan="{{size+1}}" class="text-center">无数据</td>
						</tr>
						{{# }}}
				{{#}}}
			{{#}}}
			</tbody>
		</table>
	</div>
</script>